package net.crowdloud.client.problem;

import net.crowdloud.client.GlobalVariables;
import net.crowdloud.client.user.GetUser;
import net.crowdloud.shared.entities.Problem;
import net.crowdloud.shared.entities.User;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;

public class UpdateProblem {

	final ProblemDatabaseServerCallsAsync databaseServerCalls = GWT
			.create(ProblemDatabaseServerCalls.class);

	public UpdateProblem(final User user, Problem problem) {

		databaseServerCalls.updateProblem(user.getUserID(), problem,
				GlobalVariables.tags.getTagsList(), new AsyncCallback<Void>() {

					@Override
					public void onSuccess(Void result) {

						new GetUser(user);
					}

					public void onFailure(Throwable caught) {
						// Show the RPC error message to the user

					}

				});

	}
}